home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib / tk / checkbuttn.man < prev    next >
Encoding:
Text File  |  1992-08-24  |  13.5 KB  |  461 lines

  1. '\"
  2. '\" Copyright 1990 Regents of the University of California
  3. '\" Permission to use, copy, modify, and distribute this
  4. '\" documentation for any purpose and without fee is hereby
  5. '\" granted, provided that this notice appears in all copies.
  6. '\" The University of California makes no representations about
  7. '\" the suitability of this material for any purpose.  It is
  8. '\" provided "as is" without express or implied warranty.
  9. '\" 
  10. '\" $Header: /user6/ouster/wish/man/RCS/checkbuttn.man,v 1.18 92/05/29 14:01:25 ouster Exp $ SPRITE (Berkeley)
  11. '/" 
  12. .\" The definitions below are for supplemental macros used in Sprite
  13. .\" manual entries.
  14. .\"
  15. .\" .HS name section [date [version]]
  16. .\"    Replacement for .TH in other man pages.  See below for valid
  17. .\"    section names.
  18. .\"
  19. .\" .AP type name in/out [indent]
  20. .\"    Start paragraph describing an argument to a library procedure.
  21. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  22. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  23. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  24. .\"    needed;  use .AS below instead)
  25. .\"
  26. .\" .AS [type [name]]
  27. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  28. .\"    name are examples of largest possible arguments that will be passed
  29. .\"    to .AP later.  If args are omitted, default tab stops are used.
  30. .\"
  31. .\" .BS
  32. .\"    Start box enclosure.  From here until next .BE, everything will be
  33. .\"    enclosed in one large box.
  34. .\"
  35. .\" .BE
  36. .\"    End of box enclosure.
  37. .\"
  38. .\" .VS
  39. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  40. .\"    of man pages.
  41. .\"
  42. .\" .VE
  43. .\"    End of vertical sidebar.
  44. .\"
  45. .\" .DS
  46. .\"    Begin an indented unfilled display.
  47. .\"
  48. .\" .DE
  49. .\"    End of indented unfilled display.
  50. .\"
  51. '\"    # Heading for Sprite man pages
  52. .de HS
  53. .if '\\$2'cmds'       .TH \\$1 1 \\$3 \\$4
  54. .if '\\$2'lib'        .TH \\$1 3 \\$3 \\$4
  55. .if '\\$2'tcl'        .TH \\$1 3 \\$3 \\$4
  56. .if '\\$2'tk'         .TH \\$1 3 \\$3 \\$4
  57. .if t .wh -1.3i ^B
  58. .nr ^l \\n(.l
  59. .ad b
  60. ..
  61. '\"    # Start an argument description
  62. .de AP
  63. .ie !"\\$4"" .TP \\$4
  64. .el \{\
  65. .   ie !"\\$2"" .TP \\n()Cu
  66. .   el          .TP 15
  67. .\}
  68. .ie !"\\$3"" \{\
  69. .ta \\n()Au \\n()Bu
  70. \&\\$1    \\fI\\$2\\fP    (\\$3)
  71. .\".b
  72. .\}
  73. .el \{\
  74. .br
  75. .ie !"\\$2"" \{\
  76. \&\\$1    \\fI\\$2\\fP
  77. .\}
  78. .el \{\
  79. \&\\fI\\$1\\fP
  80. .\}
  81. .\}
  82. ..
  83. '\"    # define tabbing values for .AP
  84. .de AS
  85. .nr )A 10n
  86. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  87. .nr )B \\n()Au+15n
  88. .\"
  89. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  90. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  91. ..
  92. '\"    # BS - start boxed text
  93. '\"    # ^y = starting y location
  94. '\"    # ^b = 1
  95. .de BS
  96. .br
  97. .mk ^y
  98. .nr ^b 1u
  99. .if n .nf
  100. .if n .ti 0
  101. .if n \l'\\n(.lu\(ul'
  102. .if n .fi
  103. ..
  104. '\"    # BE - end boxed text (draw box now)
  105. .de BE
  106. .nf
  107. .ti 0
  108. .mk ^t
  109. .ie n \l'\\n(^lu\(ul'
  110. .el \{\
  111. .\"    Draw four-sided box normally, but don't draw top of
  112. .\"    box if the box started on an earlier page.
  113. .ie !\\n(^b-1 \{\
  114. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  115. .\}
  116. .el \}\
  117. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  118. .\}
  119. .\}
  120. .fi
  121. .br
  122. .nr ^b 0
  123. ..
  124. '\"    # VS - start vertical sidebar
  125. '\"    # ^Y = starting y location
  126. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  127. .de VS
  128. .mk ^Y
  129. .ie n 'mc \s12\(br\s0
  130. .el .nr ^v 1u
  131. ..
  132. '\"    # VE - end of vertical sidebar
  133. .de VE
  134. .ie n 'mc
  135. .el \{\
  136. .ev 2
  137. .nf
  138. .ti 0
  139. .mk ^t
  140. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  141. .sp -1
  142. .fi
  143. .ev
  144. .\}
  145. .nr ^v 0
  146. ..
  147. '\"    # Special macro to handle page bottom:  finish off current
  148. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  149. '\"    # page bottom macro.
  150. .de ^B
  151. .ev 2
  152. 'ti 0
  153. 'nf
  154. .mk ^t
  155. .if \\n(^b \{\
  156. .\"    Draw three-sided box if this is the box's first page,
  157. .\"    draw two sides but no top otherwise.
  158. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  159. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  160. .\}
  161. .if \\n(^v \{\
  162. .nr ^x \\n(^tu+1v-\\n(^Yu
  163. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  164. .\}
  165. .bp
  166. 'fi
  167. .ev
  168. .if \\n(^b \{\
  169. .mk ^y
  170. .nr ^b 2
  171. .\}
  172. .if \\n(^v \{\
  173. .mk ^Y
  174. .\}
  175. ..
  176. '\"    # DS - begin display
  177. .de DS
  178. .RS
  179. .nf
  180. .sp
  181. ..
  182. '\"    # DE - end display
  183. .de DE
  184. .fi
  185. .RE
  186. .sp .5
  187. ..
  188. .HS checkbutton cmds
  189. .BS
  190. '\" Note:  do not modify the .SH NAME line immediately below!
  191. .SH NAME
  192. checkbutton \- Create and manipulate check-button widgets
  193. .SH SYNOPSIS
  194. \fBcheckbutton\fI pathName \fR?\fIoptions\fR?
  195. .SH "STANDARD OPTIONS"
  196. .LP
  197. .nf
  198. .ta 4c 8c 12c
  199. .VS
  200. \fBactiveBackground\fR    \fBbitmap\fR    \fBfont\fR    \fBrelief\fR
  201. \fBactiveForeground\fR    \fBborderWidth\fR    \fBforeground\fR    \fBtext\fR
  202. \fBanchor\fR    \fBcursor\fR    \fBpadX\fR    \fBtextVariable\fR
  203. \fBbackground\fR    \fBdisabledForeground\fR    \fBpadY\fR
  204. .VE
  205. .fi
  206. .LP
  207. See the ``options'' manual entry for details on the standard options.
  208. .SH "WIDGET-SPECIFIC OPTIONS"
  209. .ta 4c
  210. .LP
  211. .nf
  212. Name:    \fBcommand\fR
  213. Class:    \fBCommand\fR
  214. Command-Line Switch:    \fB\-command\fR
  215. .fi
  216. .IP
  217. Specifies a Tcl command to associate with the button.  This command
  218. is typically invoked when mouse button 1 is released over the button
  219. window.
  220. .LP
  221. .nf
  222. .VS
  223. Name:    \fBheight\fR
  224. Class:    \fBHeight\fR
  225. Command-Line Switch:    \fB\-height\fR
  226. .fi
  227. .IP
  228. Specifies a desired height for the button.
  229. If a bitmap is being displayed in the button then the value is in
  230. screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
  231. for text it is in lines of text.
  232. If this option isn't specified, the button's desired height is computed
  233. from the size of the bitmap or text being displayed in it.
  234. .VE
  235. .LP
  236. .nf
  237. Name:    \fBoffValue\fR
  238. Class:    \fBValue\fR
  239. Command-Line Switch:    \fB\-offvalue\fR
  240. .fi
  241. .IP
  242. Specifies value to store in the button's associated variable whenever
  243. this button is deselected.  Defaults to ``0''.
  244. .LP
  245. .nf
  246. Name:    \fBonValue\fR
  247. Class:    \fBValue\fR
  248. Command-Line Switch:    \fB\-onvalue\fR
  249. .fi
  250. .IP
  251. Specifies value to store in the button's associated variable whenever
  252. this button is selected.  Defaults to ``1''.
  253. .LP
  254. .nf
  255. Name:    \fBselector\fR
  256. Class:    \fBForeground\fR
  257. Command-Line Switch:    \fB\-selector\fR
  258. .fi
  259. .IP
  260. Specifies the color to draw in the selector when this button is
  261. selected.
  262. .VS
  263. If specified as an empty string then no selector is
  264. drawn for the button.
  265. .LP
  266. .nf
  267. Name:    \fBstate\fR
  268. Class:    \fBState\fR
  269. Command-Line Switch:    \fB\-state\fR
  270. .fi
  271. .IP
  272. Specifies one of three states for the check button:  \fBnormal\fR, \fBactive\fR,
  273. or \fBdisabled\fR.  In normal state the check button is displayed using the
  274. \fBforeground\fR and \fBbackground\fR options.  The active state is
  275. typically used when the pointer is over the check button.  In active state
  276. the check button is displayed using the \fBactiveForeground\fR and
  277. \fBactiveBackground\fR options.  Disabled state means that the check button
  278. is insensitive:  it doesn't activate and doesn't respond to mouse
  279. button presses.  In this state the \fBdisabledForeground\fR and
  280. \fBbackground\fR options determine how the check button is displayed.
  281. .VE
  282. .LP
  283. .nf
  284. Name:    \fBvariable\fR
  285. Class:    \fBVariable\fR
  286. Command-Line Switch:    \fB\-variable\fR
  287. .fi
  288. .IP
  289. Specifies name of global variable to set to indicate whether
  290. or not this button is selected.  Defaults to the name of the
  291. button.
  292. .LP
  293. .nf
  294. .VS
  295. Name:    \fBwidth\fR
  296. Class:    \fBWidth\fR
  297. Command-Line Switch:    \fB\-width\fR
  298. .fi
  299. .IP
  300. Specifies a desired width for the button.
  301. If a bitmap is being displayed in the button then the value is in
  302. screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR);
  303. for text it is in characters.
  304. If this option isn't specified, the button's desired width is computed
  305. from the size of the bitmap or text being displayed in it.
  306. .VE
  307. .BE
  308.  
  309. .SH DESCRIPTION
  310. .PP
  311. The \fBcheckbutton\fR command creates a new window (given by the
  312. \fIpathName\fR argument) and makes it into a check-button widget.
  313. Additional
  314. options, described above, may be specified on the command line
  315. or in the option database
  316. to configure aspects of the check button such as its colors, font,
  317. text, and initial relief.  The \fBcheckbutton\fR command returns its
  318. \fIpathName\fR argument.  At the time this command is invoked,
  319. there must not exist a window named \fIpathName\fR, but
  320. \fIpathName\fR's parent must exist.
  321. .PP
  322. A check button is a widget
  323. .VS
  324. that displays a textual string or bitmap
  325. and a square called a \fIselector\fR.
  326. A check button has
  327. all of the behavior of a simple button, including the
  328. following: it can display itself in either of three different
  329. ways, according to the \fBstate\fR option;
  330. .VE
  331. it can be made to appear
  332. raised, sunken, or flat; it can be made to flash; and it invokes
  333. a Tcl command whenever mouse button 1 is clicked over the
  334. check button.
  335. .PP
  336. In addition, check buttons can be \fIselected\fR.  If a check button is
  337. selected then a special highlight appears in the selector, and
  338. a Tcl variable associated with the check button is set to a particular
  339. value (normally 1).  If the check button is not selected, then
  340. the selector is drawn in a different fashion and the associated
  341. variable is set to a different value (typically 0).  By default,
  342. the name of the variable associated with a check button is the
  343. same as the \fIname\fR used to create the check button.  The
  344. variable name, and the ``on'' and ``off'' values stored in it,
  345. may be modified with options on the command line or in the option
  346. database.  By default a check button is configured to select and deselect
  347. itself on alternate button clicks.
  348. .VS
  349. In addition, each check button monitors its associated variable and
  350. automatically selects and deselects itself when the variables value
  351. changes to and from the button's ``on'' value.
  352. .VE
  353.  
  354. .SH "WIDGET COMMAND"
  355. .PP
  356. The \fBcheckbutton\fR command creates a new Tcl command whose
  357. name is \fIpathName\fR.  This
  358. command may be used to invoke various
  359. operations on the widget.  It has the following general form:
  360. .DS C
  361. \fIpathName option \fR?\fIarg arg ...\fR?
  362. .DE
  363. \fIOption\fR and the \fIarg\fRs
  364. determine the exact behavior of the command.  The following
  365. commands are possible for check button widgets:
  366. .TP
  367. \fIpathName \fBactivate\fR
  368. Change the check button's state to \fBactive\fR and redisplay the button
  369. using its active foreground and background colors instead of normal
  370. colors.
  371. .VS
  372. This command is ignored if the check button's state is \fBdisabled\fR.
  373. This command is obsolete and will eventually be removed;
  374. use ``\fIpathName \fBconfigure \-state active\fR'' instead.
  375. .VE
  376. .TP
  377. \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
  378. Query or modify the configuration options of the widget.
  379. If no \fIoption\fR is specified, returns a list describing all of
  380. the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
  381. information on the format of this list).  If \fIoption\fR is specified
  382. with no \fIvalue\fR, then the command returns a list describing the
  383. one named option (this list will be identical to the corresponding
  384. sublist of the value returned if no \fIoption\fR is specified).  If
  385. one or more \fIoption\-value\fR pairs are specified, then the command
  386. modifies the given widget option(s) to have the given value(s);  in
  387. this case the command returns an empty string.
  388. \fIOption\fR may have any of the values accepted by the \fBcheckbutton\fR
  389. command.
  390. .TP
  391. \fIpathName \fBdeactivate\fR
  392. Change the check button's state to \fBnormal\fR and redisplay the button
  393. using its normal foreground and background colors.
  394. .VS
  395. This command is ignored if the check button's state is \fBdisabled\fR.
  396. This command is obsolete and will eventually be removed;
  397. use ``\fIpathName \fBconfigure \-state normal\fR'' instead.
  398. .VE
  399. .TP
  400. \fIpathName \fBdeselect\fR
  401. Deselect the check button:  redisplay it without a highlight in
  402. the selector and set the associated variable to its ``off''
  403. value.
  404. .TP
  405. \fIpathName \fBflash\fR
  406. Flash the check button.  This is accomplished by redisplaying the check button
  407. several times, alternating between active and normal colors.  At
  408. the end of the flash the check button is left in the same normal/active
  409. state as when the command was invoked.
  410. .VS
  411. This command is ignored if the check button's state is \fBdisabled\fR.
  412. .VE
  413. .TP
  414. \fIpathName \fBinvoke\fR
  415. .VS
  416. Does just what would have happened if the user invoked the check button
  417. with the mouse: toggle the selection state of the button and invoke
  418. the Tcl command associated with the check button, if there is one.
  419. The return value is the return value from the Tcl command, or an
  420. empty string if there is no command associated with the check button.
  421. This command is ignored if the check button's state is \fBdisabled\fR.
  422. .VE
  423. .TP
  424. \fIpathName \fBselect\fR
  425. Select the check button:  display it with a highlighted
  426. selector and set the associated variable to its ``on''
  427. value.
  428. .TP
  429. \fIpathName \fBtoggle\fR
  430. Toggle the selection state of the button, redisplaying it and
  431. modifying its associated variable to reflect the new state.
  432.  
  433. .SH BINDINGS
  434. .PP
  435. .VS
  436. Tk automatically creates class bindings for check buttons that give them
  437. the following default behavior:
  438. .IP [1]
  439. The check button activates whenever the mouse passes over it and deactivates
  440. whenever the mouse leaves the check button.
  441. .IP [2]
  442. The check button's relief is changed to sunken whenever mouse button 1 is
  443. pressed over it, and the relief is restored to its original
  444. value when button 1 is later released.
  445. .IP [3]
  446. If mouse button 1 is pressed over the check button and later released over
  447. the check button, the check button is invoked (i.e. its selection
  448. state toggles and the command associated with the button is invoked,
  449. if there is one).  However, if the mouse is not
  450. over the check button when button 1 is released, then no invocation occurs.
  451. .PP
  452. If the check button's state is \fBdisabled\fR then none of the above
  453. actions occur:  the check button is completely non-responsive.
  454. .PP
  455. The behavior of check buttons can be changed by defining new bindings for
  456. individual widgets or by redefining the class bindings.
  457. .VE
  458.  
  459. .SH KEYWORDS
  460. check button, widget
  461.